<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache, no-store" />
<title>NET355 搜索</title>
<jsp:include page="/resource/pages/key.html"></jsp:include>
<link href="/resource/css/common.css" rel="stylesheet" type="text/css" />
<link href="/resource/css/index.css" rel="stylesheet" type="text/css" />
<link href="/resource/css/toolkit.css" rel="stylesheet" type="text/css" />
<link href="/resource/js/matchpicker/matchpicker.css" rel="stylesheet" type="text/css" />
<link href="/resource/js/datepicker/datepicker.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/resource/js/jquery.js"></script>
<script type="text/javascript" src="/resource/js/jquery.ui.effect.js"></script>
<script type="text/javascript" src="/resource/js/common.js"></script>
<script type="text/javascript" src="/resource/js/toolkit.js"></script>
<script type="text/javascript" src="/resource/js/matchpicker/matchpicker.js"></script>
<script type="text/javascript" src="/resource/js/datepicker/datepicker.js"></script>
<script type="text/javascript">
	var MenuIndex = 4;
	var NoteOffset = 10;
	var NoteSize = ${noteSize};
	var MatchKey = "";
	var DomMoreItems;
	$(document).ready(function() {
		DomMoreItems = $(".moreItems");
	});
	
	getSearch = function(){
		MatchKey = $("#ipt_search").val().trim();
		NoteOffset = 0;
		$("#div_items").empty();
		DomMoreItems.html('<a onclick="getMore();">MORE</a><input id="ipt_more_size" type="text" value="10" onkeyup="value=this.value.replace(/\D+/g,\'\');" />');
		getMore();
	};
	
	getMore = function(){
		var size = parseInt($("#ipt_more_size").val().trim(), 10);
		$.ajax({
			type : "get",
			url : "/blog/ajax/search"
				+"?ts="+new Date().getTime(),
			dataType : "json",
			data: {key: MatchKey, offset: NoteOffset, size: size}
		}).done(function(result){
			if(result.isTrue) {
				$("#div_items").append(result.message);
				NoteOffset = result.tag;
				if(NoteOffset>=NoteSize) {
					DomMoreItems.html('<a class="off">MORE</a><input type="text" class="off" value="0" readonly="readonly" />');
				}
			} else {
				$.showAlert(result.message, "确定");
			}
		}).fail(function(){
			$.showAlert("网络繁忙，请稍后再试！", "确定");
		});
	};
</script>
</head>
<body class="bg">
	<div id="section_left" class="leftBlock">
		<jsp:include page="/resource/pages/left.html"></jsp:include>
	</div>
	
	<div id="section_right" class="rightBlock">
		<jsp:include page="/resource/pages/menu.html"></jsp:include>
		<div id="section_content" class="contentBlock">
			<div class="searchLine">
				<input id="ipt_search" type="text" onkeyup="if(event.keyCode == 13) {getSearch();}" /><i onclick="getSearch();"></i></div>
			<h3 class="normal"></h3>
			<div id="div_items">
				${noteList}
				&nbsp;
			</div>
			<div class="moreItems">
				<a onclick="getMore();">MORE</a>
				<input id="ipt_more_size" type="text" value="10" onkeyup="value=this.value.replace(/\D+/g,'');" />
			</div>
			<div style="clear: both; height: 30px;"></div>
		</div>
	</div>
	
	<jsp:include page="/resource/pages/foot.html"></jsp:include>
	
</body>
</html>



